<div ng-controller="chainBusinessEditCtrl">
    <div class="bg-light lter b-b wrapper-md ng-scope">
        <h4 class="m-n font-thin">品牌信息管理</h4>
        <button onClick="javascript: history.go(-1);" class="btn-back btn btn-dark btn-sm btn-rounded">
            返回
        </button>
    </div>

    <div class="wrapper-md">
        <div class="panel">
            <div class="panel-body">
                <div class="chain_header_container">
                    <div class="chain_header_item chain_header_item_active">
                        <span class="chain_header_item_span">品牌基本信息</span>

                        <div class="tran-right"></div>
                    </div>
                    <div class="chain_header_item chain_header_item_active">
                        <div class="tran-left"></div>
                        <span class="chain_header_item_span">品牌营业执照信息</span>
                    </div>
                </div>
                <form class="form-horizontal form-validation" name="chainInfoForm" ng-submit="updateChainInfo()">
                    <div>
                        <div class="padder-md padder-v bg-light m-b-sm">
                            <span class="font-bold">营业用户信息</span>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="营业的商户确定有效信息" popover-trigger="mouseenter"></i>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">证件类型</label>
                            <div class="col-sm-4">
                                <select class="form-control" name="identityType" ng-model="chainInfo.identityType" ng-options="item.status as item.value for item in identityType" required>
                                    <option value="">请选择证件身份</option>
                                </select>

                                <div ng-if="chainfoForm.identityType.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.identityType.$error.required">证件类型是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">真实姓名</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.identityName"
                                       placeholder="请输入真实姓名" name="identityName" maxlength="15" required>
                                <div ng-if="chainInfoForm.identityName.$touched">
                                    <label class="text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.identityName.$error.required">证件名称是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">证件号码</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.identityCode"
                                       name="identityCode" placeholder="请输入证件号码" maxlength="18" required>
                                <div ng-if="chainInfoForm.identityCode.$touched">
                                    <label class="text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.identityCode.$error.required">证件名称是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">证件图片</label>
                            <div class="col-md-5">
                                <div class="table-responsive">
                                    <table class="table-bordered m-n">
                                        <tr>
                                            <td width="100" class="text-center h6">正面照</td>
                                            <td>
                                                <div class="inline">
                                                    <uploadpic queue-limit="{{frontLimit}}" path="{{path}}"
                                                               images="frontImages" app="app" queue="frontImgQueue"
                                                               del-func="delFrontImage"></uploadpic>
                                                </div>
                                            </td>
                                            <td width="430" class="h6 text-center">
                                                <div>
                                                    <span class="block padder-v">-照片示例-</span>
                                                    <img src="img/idcard_front.png" class="inline w-sm m-b-sm"
                                                         ng-if="chainInfo.identityType==0"/>
                                                    <img src="img/ex-gangao_front.png" class="inline w-sm m-b-sm"
                                                         ng-if="chainInfo.identityType==1"/>
                                                    <img src="img/ex-taiwan_front.png" class="inline w-sm m-b-sm"
                                                         ng-if="chainInfo.identityType==2"/>
                                                    <img src="img/ex-passport.png" class="inline w-sm m-b-sm"
                                                         ng-if="chainInfo.identityType==3"/>
                                                    <span class="padder-md block h6 text-muted">证件照片上的文字需要能够清晰辨认(支持JPG、JPEG、PNG格式，大小不超过1M)</span>
                                                </div>
                                            </td>
                                        </tr>
                                        <tr ng-show="chainInfo.identityType==0">
                                            <td class="text-center h6">反面照</td>
                                            <td>
                                                <div>
                                                    <uploadpic queue-limit="{{backLimit}}" path="{{path}}"
                                                               images="backImages" app="app" queue="backImgQueue"
                                                               del-func="delBackImage"></uploadpic>
                                                </div>
                                            </td>
                                            <td width="430" class="h6 text-center">
                                                <span class="block padder-v">-照片示例-</span>
                                                <img src="img/idcard_back.png" class="inline w-sm m-b-sm"/>
                                                <span class="padder-md block h6 text-muted">证件照片上的文字需要能够清晰辨认(支持JPG、JPEG、PNG格式，大小不超过1M)</span>
                                            </td>
                                        </tr>
                                        <tr>
                                            <td class="text-center h6">手持正面照</td>
                                            <td>
                                                <div>
                                                    <uploadpic queue-limit="{{userLimit}}" path="{{path}}"
                                                               images="userImages" app="app" queue="userImgQueue"
                                                               del-func="delUserImage"></uploadpic>
                                                </div>
                                            </td>
                                            <td width="430" class="h6 text-center">
                                                <span class="block padder-v">-照片示例-</span>
                                                <img src="img/idcard_user.png" class="inline w-sm m-b-sm"/>
                                                <span class="padder-md block h6 text-muted">请参考示例照片拍摄，请勿遮挡或模糊(支持JPG、JPEG、PNG格式，大小不超过1M)</span>
                                            </td>
                                        </tr>
                                    </table>
                                </div>
                            </div>
                        </div>
                    </div>

                    <div>
                        <div class="padder-md padder-v bg-light m-b-sm">
                            <span class="font-bold">主体资质信息</span>
                            <i class="inline m-l-xs fa fa-question-circle text-muted pos-rlt h6" popover-placement="top"
                               popover="包含营业执照等正确信息" popover-trigger="mouseenter"></i>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">主体资质</label>
                            <div class="col-sm-4">
                                <select class="form-control" ng-model="chainInfo.subjectType" name="subjectType" ng-options="item.status as item.value for item in subjectType" required>
                                    <option value="">请选择主体的营业资质</option>
                                </select>
                                <div ng-if="chainInfoForm.subjectType.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.subjectType.$error.required">营业资质类型是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">单位名称</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.unitName" name="unitName"
                                       placeholder="请输入单位名称" maxlength="15" required>
                                <div ng-if="chainInfoForm.unitName.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.unitName.$error.required">单位名称类型是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">法定代表人</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.legalPerson"
                                       name="legalPerson" placeholder="请输入法定代表人" maxlength="15" required>
                                <div ng-if="chainInfoForm.legalPerson.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.legalPerson.$error.required">法定代表人是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">注册号</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.registrationMark"
                                       name="registrationMark" placeholder="请输入注册号" maxlength="35" required>
                                <div ng-if="chainInfoForm.registrationMark.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.registrationMark.$error.required">注册号是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">注册地址</label>
                            <div class="col-sm-4">
                                <input type="text" class="form-control" ng-model="chainInfo.registrationAddress"
                                       name="registrationAddress" placeholder="请输入注册地址" maxlength="50" required>
                                <div ng-if="chainInfoForm.registrationAddress.$touched">
                                    <label class="pull-left text-left text-danger h6 l-h m-t-sm"
                                           ng-if="chainInfoForm.registrationAddress.$error.required">注册地址是必需的</label>
                                </div>
                            </div>
                        </div>

                        <div class="form-group">
                            <label class="col-sm-2 control-label font-bold">证件图片</label>
                            <div class="col-md-5">
                                <div class="table-responsive">
                                    <table class="table-bordered m-n">
                                        <tr>
                                            <td width="100" class="text-center h6">资质照片</td>
                                            <td>
                                                <div>
                                                    <uploadpic queue-limit="{{subjectLimit}}" path="{{path}}"
                                                               images="subjectImages" app="app" queue="subjectImgQueue"
                                                               del-func="delSubjectImage"></uploadpic>
                                                </div>
                                            </td>
                                            <td width="430" class="h6 text-center">
                                                <span class="block padder-v">-照片示例-</span>
                                                <img src="img/buisiness-license.png" class="inline w-sm m-b-sm"/>
                                                <span class="padder-md block h6 text-muted">证件照片上的文字需要能够清晰辨认(支持JPG、JPEG、PNG格式，大小不超过1M)</span>
                                            </td>
                                        </tr>
                                    </table>

                                </div>

                            </div>
                        </div>

                        <div class="form-group">
                            <div class="col-sm-4 col-sm-offset-2">
                                <button type="submit" class="btn btn-success" ng-disabled="chainInfoForm.$invalid" ng-if="!saveState">保存</button>
                                <button class="btn btn-success" ng-if="saveState" disabled><i class="fa fa-refresh col-sm-2"></i>保存中..</button>
                            </div>
                        </div>
                    </div>

                </form>
            </div>
        </div>
    </div>
</div>